import {
	request
} from "./request.js";
import {
	checkRequired
} from "../utils/utils.js"

let api = {
	// 小程序授权登录
	claim$api$wx_login: ({
		appid,
		js_code,
		iccid,
	}) => {
		if (checkRequired([appid, js_code])) {
			return request({
				url: `/claim/api/wx_login`,
				method: "POST",
				data: {
					appid,
					js_code,
					iccid,
				}
			});
		}
	},
	// 获取滚动数据
	claim$api$get_scolling: () => {
		return request({
			url: `/claim/api/get_scolling`,
			method: "GET"
		});
	},
	// 下单
	claim$api$put_order: ({
		appid,
		openid,
		old_iccid,
		name,
		tel,
		province,
		city,
		county,
		address
	}) => {
		if (checkRequired([
				appid,
				openid, name, tel
			])) {
			return request({
				url: `/claim/api/put_order`,
				method: "POST",
				data: {
					appid,
					openid,
					old_iccid,
					name,
					tel,
					province,
					city,
					county,
					address
				}
			});
		}
	},
	// 获取订单详情
	claim$api$order_detail: ({
		id
	}) => {
		return request({
			url: `/claim/api/order_detail?id=${id}`,
			method: "GET"
		});
	},
}

export default api;